<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <title></title>
    <link rel="stylesheet" href="css/base.css"/>
    <link rel="stylesheet" href="css/index.css"/>
   <!-- <script src="zepto-master/src/zepto.min.js"></script>
    <script src="zepto-master/src/selector.js"></script>
    <script src="zepto-master/src/fx.js"></script>
    <script src="zepto-master/src/touch.js"></script>-->
    <script src="js/zepto.min.js"></script>
</head>
<body>
<div class="jd_layout">
    <div class="jd_search">
        <a href="javascript:;" class="jd_logo"></a>
        <form action="" class="searchBox">
            <input type="text" placeholder="请输入商品名称"/>
        </form>
        <a href="javascript:;" class="jd_login">登录</a>
    </div>
    <div class="jd_banner">
        <ul class="banner_img">
            <li><a href="javascript:;"><img src="./uploads/l1.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l2.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l3.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l4.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l5.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l6.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l7.jpg" alt=""/></a></li>
            <li><a href="javascript:;"><img src="./uploads/l8.jpg" alt=""/></a></li>
        </ul>
        <ol class="banner_circle">
            <li class="active"></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ol>
    </div>
    <div class="jd_nav clearfix">
        <ul>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_1.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_2.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_3.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_4.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_5.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_6.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_7.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="images/nav_8.png" alt=""/>
                    <p>商品分类</p>
                </a>
            </li>
        </ul>
    </div>
    <div class="jd_product">
        <div class="productBox jd_miaosha m_top10">
            <div class="jd_pTip">
                <div class="jd_left">
                    <span class="clock f_left"></span>
                    <span class="f_left m_left10 jd_left_text">圣诞节秒杀</span>
                    <div class="jd_time f_left m_left10">
                        <span class="f_left">0</span>
                        <span class="f_left">0</span>
                        <span class="f_left">:</span>
                        <span class="f_left">0</span>
                        <span class="f_left">0</span>
                        <span class="f_left">:</span>
                        <span class="f_left">0</span>
                        <span class="f_left">0</span>
                        <span class="f_left">:</span>
                        <span class="f_left">0</span>
                        <span class="f_left">0</span>
                    </div>
                </div>
                <div class="jd_right f_right m_right10">过节...</div>
            </div>
            <div class="jd_pContent clearfix jd_shirt">
                <ul>
                    <li>
                        <a href="javascript:;" class="f_left">
                            <img src="uploads/detail01.jpg" alt=""/>
                            <p>&yen;10.00</p>
                            <p>&yen;20.00</p>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="f_left">
                            <img src="uploads/detail01.jpg" alt=""/>
                            <p>&yen;10.00</p>
                            <p>&yen;20.00</p>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="f_left">
                            <img src="uploads/detail01.jpg" alt=""/>
                            <p>&yen;10.00</p>
                            <p>&yen;20.00</p>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="productBox m_top10">
            <div class="jd_pTip border_b">
                <h3>京东超市</h3>
            </div>
            <div class="jd_pContent clearfix">
                <a href="javascript:;"><img src="uploads/cp1.jpg" alt=""/></a>
                <a href="javascript:;" class="border_b border_l"><img src="uploads/cp2.jpg" alt=""/></a>
                <a href="javascript:;" class="border_l"><img src="uploads/cp3.jpg" alt=""/></a>
            </div>
        </div>
        <div class="productBox m_top10">
            <div class="jd_pTip border_b">
                <h3>京东超市</h3>
            </div>
            <div class="jd_pContent clearfix">
                <a href="javascript:;"><img src="uploads/cp4.jpg" alt=""/></a>
                <a href="javascript:;" class="border_b border_r"><img src="uploads/cp5.jpg" alt=""/></a>
                <a href="javascript:;" class="border_r"><img src="uploads/cp6.jpg" alt=""/></a>
            </div>
        </div>
        <div class="productBox m_top10">
            <div class="jd_pTip border_b">
                <h3>京东超市</h3>
            </div>
            <div class="jd_pContent clearfix">
                <a href="javascript:;"><img src="uploads/cp1.jpg" alt=""/></a>
                <a href="javascript:;" class="border_b border_l"><img src="uploads/cp2.jpg" alt=""/></a>
                <a href="javascript:;" class="border_l"><img src="uploads/cp3.jpg" alt=""/></a>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var banner = $('.jd_banner');
        var bannerWidth = banner.width();
        var imgBox = $('.banner_img');
        var circle = $('.banner_circle').find('li');
        var first = imgBox.find('li:first-of-type');
        var last = imgBox.find('li:last-of-type');
        imgBox.append(first.clone());
        last.clone().insertBefore(first);
        var lis = imgBox.find('li');
        var count = lis.length;
        imgBox.width(bannerWidth * count);
        lis.each(function (index, element) {
            $(lis[index]).width(bannerWidth);
        })
        imgBox.css('left',-bannerWidth)
        window.onresize = function () {
            bannerWidth = banner.width();
            imgBox.width(bannerWidth * count);
            lis.each(function (index, element) {
                $(lis[index]).width(bannerWidth);
            })
            imgBox.css('left',-bannerWidth)
        }
        var index = 1;
        function imgAnimate() {
            imgBox.animate(
                    {'left':-index * bannerWidth},
                    500,
                    'ease-in-out',
                    function () {
                        if (index == count -1) {
                            index = 1;
                            imgBox.css('left',-index * bannerWidth)
                        } else if (index == 0) {
                            index = count - 2;
                            imgBox.css('left',-index * bannerWidth)
                        }
                        circle.removeClass('active').eq(index - 1).addClass('active')
                    })
        }
        var timerId;
        function startTime () {
            timerId = setInterval(function () {
                index++;
                imgAnimate();
            },2000)
        }
        startTime();
        imgBox.on('swipeLeft',function () {
            index++;
            clearInterval(timerId);
            imgAnimate();
            startTime()
        })
        imgBox.on('swipeRight',function () {
            index--;
            clearInterval(timerId);
            imgAnimate();
            startTime()
        })
    })
</script>
</body>
</html>